<!--
Copyright 2009 Cordys R&D B.V. 

This file is part of the Cordys SAP Connector. 

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<html xmlns:eibus onselect="selectApplication()">
<head>	
	<link rel="stylesheet" type="text/css" href="/cordys/wcp/style/behaviors.css">
	<script src = "/cordys/wcp/xml/xml.js"></script>	
	<script language = "JavaScript">
	
	function selectApplication()
	{
		application.container.maximize();
		var parentId=window.event.data;
		
		constructor_IdocControlRecord.selectSingleNode(".//IDOCNum").text =system.windows[parentId].IDOCNum_id;
		constructor_IdocDataRecord.selectSingleNode(".//IDOCNum").text =system.windows[parentId].IDOCNum_id;
		
		bdiControlRecord.request= constructor_IdocControlRecord.XMLDocument.cloneNode(true);
		bdiDataRecord.request= constructor_IdocDataRecord.XMLDocument.cloneNode(true);
		
		bdiControlRecord.reset();
		bdiDataRecord.reset();
		var controlXMLNode = new ActiveXObject("Microsoft.XMLDOM");
		var dataXMLNode = new ActiveXObject("Microsoft.XMLDOM");
		
		var xControlpath="data/GetControlRecordResponse/tuple/old/IDOCTable/ControlRecord";
		var xDatapath="data/GetDataRecordResponse/tuple/old/IDOCTable/DataRecord";
		var Controlnode = bdiControlRecord.data.selectSingleNode(xControlpath);	
		var Datanode=bdiDataRecord.data.selectSingleNode(xDatapath);		
		
		controlXMLNode.loadXML(Controlnode.text);
		dataXMLNode.loadXML(Datanode.text);
		var idocNode = dataXMLNode.selectSingleNode(".//IDOC");		
		var firstSegmentNode = idocNode.firstChild;		
		idocNode.insertBefore(controlXMLNode.documentElement, firstSegmentNode);	
		xml2html(dataXMLNode,div_interface);	
	}
	
	</script>
</head>

<!----------------Bus data island for getting Idoc Control Records----------------->
	<eibus:dataisland id="bdiControlRecord" async="false" automatic="false">
		<xml id="constructor_IdocControlRecord">
			<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
				<SOAP:Body>
					<GetControlRecord xmlns="http://schemas.cordys.com/IDOCTable">
						<IDOCNum></IDOCNum>
					</GetControlRecord>	
				</SOAP:Body>
			</SOAP:Envelope>
		</xml>
	</eibus:dataisland>
<!--------------------------------------------------------------------------------->

<!----------------Bus data island for getting Idoc Data Records-------------------->
	<eibus:dataisland id="bdiDataRecord" async="false" automatic="false">
		<xml id="constructor_IdocDataRecord">
			<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
				<SOAP:Body>
					<GetDataRecord xmlns="http://schemas.cordys.com/IDOCTable">
						<IDOCNum></IDOCNum>
					</GetDataRecord>
				</SOAP:Body>
			</SOAP:Envelope>
		</xml>
	</eibus:dataisland>
<!--------------------------------------------------------------------------------->


<body>
	<div id="div_interface" style="height:100%;width:400"></div>
</body>
</html>
